<!DOCTYPE html>



  


<html class="theme-next pisces use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">




<script>
    (function(){
        if(''){
            if (prompt('请输入文章密码') !== ''){
                alert('密码错误！');
                history.back();
            }
        }
    })();
  </script>






<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />



  <link rel="icon" type="image/png" sizes="32x32" href="/favicon.ico?v=5.1.4">







  <meta name="keywords" content="Swift," />





  <link rel="alternate" href="/atom.xml" title="Swift社区" type="application/atom+xml" />






<meta name="description" content="前言本期是 Swift 编辑组自主整理周报的第二十期，每个模块已初步成型。各位读者如果有好的提议，欢迎在文末留言。 Swift 周报在 GitHub 开源，欢迎提交 issue，投稿或推荐内容。目前计划每两周周一发布，欢迎志同道合的朋友一起加入周报整理。 最无情的永远不是环境，而是缺乏勇气的内心。Swift社区与你一起，赤胆平乱世，长枪定江山！👊👊👊  周报精选 新闻和社区：担心泄密！外媒：">
<meta name="keywords" content="Swift">
<meta property="og:type" content="article">
<meta property="og:title" content="Swift 周报 第二十九期">
<meta property="og:url" content="https://fanbaoying.github.io/Swift-周报-第二十九期/index.html">
<meta property="og:site_name" content="Swift社区">
<meta property="og:description" content="前言本期是 Swift 编辑组自主整理周报的第二十期，每个模块已初步成型。各位读者如果有好的提议，欢迎在文末留言。 Swift 周报在 GitHub 开源，欢迎提交 issue，投稿或推荐内容。目前计划每两周周一发布，欢迎志同道合的朋友一起加入周报整理。 最无情的永远不是环境，而是缺乏勇气的内心。Swift社区与你一起，赤胆平乱世，长枪定江山！👊👊👊  周报精选 新闻和社区：担心泄密！外媒：">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://files.mdnice.com/user/17787/c465cfe7-1b3a-49d3-820c-e7b06fd7738b.png">
<meta property="og:image" content="https://user-images.githubusercontent.com/24238160/132703149-34121c6c-fd18-491c-a697-58a0fabf3060.png">
<meta property="og:updated_time" content="2023-07-04T07:30:45.241Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Swift 周报 第二十九期">
<meta name="twitter:description" content="前言本期是 Swift 编辑组自主整理周报的第二十期，每个模块已初步成型。各位读者如果有好的提议，欢迎在文末留言。 Swift 周报在 GitHub 开源，欢迎提交 issue，投稿或推荐内容。目前计划每两周周一发布，欢迎志同道合的朋友一起加入周报整理。 最无情的永远不是环境，而是缺乏勇气的内心。Swift社区与你一起，赤胆平乱世，长枪定江山！👊👊👊  周报精选 新闻和社区：担心泄密！外媒：">
<meta name="twitter:image" content="https://files.mdnice.com/user/17787/c465cfe7-1b3a-49d3-820c-e7b06fd7738b.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://fanbaoying.github.io/Swift-周报-第二十九期/"/>





  <title>Swift 周报 第二十九期 | Swift社区</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>
    
    <a href="https://github.com/SwiftCommunityRes" class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
    
    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Swift社区</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">做最好的 Swift 社区</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://fanbaoying.github.io/Swift-周报-第二十九期/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Swift社区">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="https://avatars.githubusercontent.com/u/84354365?v=4">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Swift社区">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Swift 周报 第二十九期</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2023-07-04T15:20:09+08:00">
                2023-07-04
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Swift-周报/" itemprop="url" rel="index">
                    <span itemprop="name">Swift 周报</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          
            <div class="post-wordcount">
              
                
                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>

                <!-- 
                  <span class="post-meta-item-text">字数统计&#58;</span>
                
                -->
                <span title="字数统计">
                  数字统计 4,118字
                </span>
              

              
                <span class="post-meta-divider">|</span>
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>

                <!-- 
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                
                --> 

                <span title="阅读时长">
                  阅读时长 16分钟
                </span>
              
            </div>
          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h2><p><strong>本期是 Swift 编辑组自主整理周报的第二十期</strong>，每个模块已初步成型。各位读者如果有好的提议，欢迎在文末留言。</p>
<p>Swift 周报在 <a href="https://github.com/SwiftCommunityRes/SwiftWeekly" title="SwiftWeekly" target="_blank" rel="noopener">GitHub 开源</a>，欢迎提交 issue，投稿或推荐内容。目前计划每两周周一发布，欢迎志同道合的朋友一起加入周报整理。</p>
<p>最无情的永远不是环境，而是缺乏勇气的内心。<strong>Swift社区</strong>与你一起，赤胆平乱世，长枪定江山！👊👊👊</p>
<blockquote>
<p><strong>周报精选</strong></p>
<p>新闻和社区：担心泄密！外媒：苹果公司限制员工使用ChatGPT</p>
<p>提案：value 包展开的元组</p>
<p>Swift 论坛：讨论 Xcode 忽略 Package.resolved 文件</p>
<p>推荐博文：万字长文详解如何使用 Swift 提高代码质量</p>
<p><strong>话题讨论：</strong> </p>
<p>一群男的在找女朋友，一群女的在找男朋友，两群人互不干涉，什么原因引起的？</p>
</blockquote>
<p><strong>上期话题结果</strong></p>
<a id="more"></a>
<p><img src="https://files.mdnice.com/user/17787/c465cfe7-1b3a-49d3-820c-e7b06fd7738b.png" alt=""></p>
<p>上期话题讨论结果表明对于 AI 是否会取代软件工程师的问题，大家的观点存在分歧，而实际的结果可能<strong>取决于 AI 技术的发展和与人类工程师的协作方式的演变</strong>。让我们拭目以待。</p>
<h2 id="新闻和社区"><a href="#新闻和社区" class="headerlink" title="新闻和社区"></a>新闻和社区</h2><h3 id="担心泄密！外媒：苹果公司限制员工使用ChatGPT"><a href="#担心泄密！外媒：苹果公司限制员工使用ChatGPT" class="headerlink" title="担心泄密！外媒：苹果公司限制员工使用ChatGPT"></a>担心泄密！外媒：苹果公司限制员工使用ChatGPT</h3><p>中新经纬 5 月 19 日电 据华尔街日报中文网 19 日报道，其获悉的一份文件以及知情人士的消息显示，苹果公司已经限制使用 ChatGPT 和其他外部 AI 工具。</p>
<p>根据这份文件，苹果公司担心员工使用这类程序可能会泄露机密数据。该文件还称，苹果公司还告诉员工，不要使用微软所有的 GitHub 的产品 Copilot。Copilot 可以自动编写软件代码。</p>
<p>ChatGPT 是 AI 研究公司 OpenAI 开发的一款人工智能聊天机器人。该产品于 2022 年 11 月发布，可以进行从历史到哲学等话题的对话，并对计算机程序代码提供修改建议。</p>
<p>值得注意的是，在 ChatGPT 爆火的背后，也出现过商业泄密的重大事故。</p>
<p>今年 4 月，据多家媒体报道，三星电子引入聊天机器人 ChatGPT 不到 20 天，便曝出机密资料外泄，如半导体设备测量数据、产品良率等内容。为杜绝类似事故再发生，三星制定相关保护措施，该公司向员工表示，“若采取信息保护紧急措施后仍发生类似事故，公司内部网络可能会切断 ChatGPT 连接”。</p>
<p>此外，已经有国家监管机构注意到了数据安全风险。</p>
<p>当地时间 3 月 31 日，意大利个人数据保护局宣布，即日起禁止使用聊天机器人 ChatGPT ，限制其开发公司 OpenAI 处理意大利用户信息，并开始立案调查。意大利个人数据保护局认为，3 月 20 日 ChatGPT 平台出现了用户对话数据和付款服务支付信息丢失情况，而该平台没有就收集处理用户信息进行告知，且缺乏大量收集和存储个人信息的法律依据。(中新经纬APP)</p>
<h3 id="苹果公司大幅削减其MR头显销售预期，不足百万台"><a href="#苹果公司大幅削减其MR头显销售预期，不足百万台" class="headerlink" title="苹果公司大幅削减其MR头显销售预期，不足百万台"></a>苹果公司大幅削减其MR头显销售预期，不足百万台</h3><p>品玩 5 月 19 日讯，据界面新闻消息，苹果公司已将其期待已久的混合现实（MR）头显的销售预期下调约三分之二。报道指出，苹果最初希望每年销售约 300 万台，但现在已将销售预期削减至约 100 万台，随后又下调至 90 万台。该公司将于 6 月 5 日举行全球开发者大会，预计将在会上展示该产品。该设备的售价预计会高达 3000 美元左右，是 Meta Platforms 最昂贵的 Quest Pro 头显售价的三倍。</p>
<h2 id="提案"><a href="#提案" class="headerlink" title="提案"></a>提案</h2><h3 id="通过的提案"><a href="#通过的提案" class="headerlink" title="通过的提案"></a>通过的提案</h3><p><a href="https://github.com/apple/swift-evolution/blob/main/proposals/0396-never-codable.md" title="SE-0396" target="_blank" rel="noopener">SE-0396</a> <strong>Never 遵守 Codable</strong> 提案通过审查。该提案已在 <strong>二十八期周报</strong> 正在审查的提案模块做了详细介绍。</p>
<p><a href="https://github.com/apple/swift-evolution/blob/main/proposals/0398-variadic-types.md" title="SE-0398" target="_blank" rel="noopener">SE-0398</a> <strong>允许泛型类型对包进行抽象声明</strong> 提案通过审查。该提案已在 <strong>二十八期周报</strong> 正在审查的提案模块做了详细介绍。</p>
<h3 id="正在审查的提案"><a href="#正在审查的提案" class="headerlink" title="正在审查的提案"></a>正在审查的提案</h3><p><a href="https://github.com/apple/swift-evolution/blob/main/proposals/0398-variadic-types.md" title="SE-0398" target="_blank" rel="noopener">SE-0398</a> <strong>value 包展开的元组</strong> 提案正在审查。</p>
<p>之前的 SE-0393 引入了 Value 和 Type 参数包。该提案允许引用一个包含在重复模式中的 value 包的元组值。</p>
<h2 id="Swift-论坛"><a href="#Swift-论坛" class="headerlink" title="Swift 论坛"></a>Swift 论坛</h2><p>1) 讨论<a href="https://forums.swift.org/t/swiftui-charts-very-large-data-sets-and-chart-overlay/65054" title="SwiftUI 图表、超大数据集和图表叠加" target="_blank" rel="noopener">SwiftUI 图表、超大数据集和图表叠加</a></p>
<p>2) 讨论<a href="https://forums.swift.org/t/sendable-warning-with-thread-safe-property-wrapper/65053" title="带有线程安全属性包装器的可发送警告" target="_blank" rel="noopener">带有线程安全属性包装器的可发送警告</a></p>
<p>当使用有针对性的严格并发进行构建时，我收到一条警告，我想知道除了使我的类型“未经检查的可发送”之外，我是否可以做任何事情。</p>
<p>考虑一些线程安全的属性包装器：</p>
<figure class="highlight swift"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">@propertyWrapper <span class="class"><span class="keyword">struct</span> <span class="title">ThreadSafe</span>&lt;<span class="title">Value</span>: <span class="title">Sendable</span>&gt;: <span class="title">Sendable</span> </span>&#123;</span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">let</span> lock: <span class="type">Lock</span>&lt;<span class="type">Value</span>&gt;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">var</span> wrappedValue: <span class="type">Value</span> &#123;</span><br><span class="line">        <span class="keyword">get</span> &#123; lock.withLock &#123; $<span class="number">0</span> &#125; &#125;</span><br><span class="line">        <span class="keyword">set</span> &#123; lock.withLock &#123; $<span class="number">0</span> = newValue &#125; &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    </span><br><span class="line">    <span class="keyword">init</span>(wrappedValue: <span class="type">Value</span>) &#123;</span><br><span class="line">        <span class="keyword">self</span>.<span class="keyword">init</span>(lock: .<span class="keyword">init</span>(initialState: wrappedValue))</span><br><span class="line">    &#125;</span><br><span class="line">    </span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">init</span>(lock: <span class="type">Lock</span>&lt;<span class="type">Value</span>&gt;) &#123;</span><br><span class="line">        <span class="keyword">self</span>.lock = lock</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>并考虑使用它来强制执行线程安全和可发送性的类：</p>
<figure class="highlight swift"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">final</span> <span class="class"><span class="keyword">class</span> <span class="title">SomeSendable</span>: <span class="title">Sendable</span> </span>&#123;</span><br><span class="line">    @<span class="type">ThreadSafe</span></span><br><span class="line">    <span class="keyword">var</span> someBool: <span class="type">Bool</span> = <span class="literal">false</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>即使我的课程是线程安全的，我仍然收到此警告：</p>
<figure class="highlight swift"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">Stored</span> property '_someBool' of '<span class="type">Sendable'</span>-conforming <span class="class"><span class="keyword">class</span> '<span class="title">SomeSendable</span>' <span class="title">is</span> <span class="title">mutable</span></span></span><br></pre></td></tr></table></figure>
<p>编译器诊断似乎没有检查属性包装器的可发送性。</p>
<p>有没有办法在不使我的类型“未选中”的情况下平息此警告？</p>
<p><strong>回答</strong></p>
<p>问题是任何带有 var 的类总是不可发送的，并且属性包装器不允许 let。</p>
<p>但对我来说，真正的问题是 SomeSendable 使用起来真的不是那么安全，特别是 <code>@ThreadSafe</code> 是不安全的。 它使得以易受竞争影响的方式使用可变状态变得太容易了。 由于数据被锁定，您肯定不会遇到运行时崩溃，但您很容易得到不正确的结果。</p>
<p>例如，像旋转 1,000 个任务来切换布尔值这样简单的事情在最后总是会产生一个真值，但有时你会得到假，有时你会得到真：</p>
<figure class="highlight swift"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">let</span> object = <span class="type">SomeSendable</span>()</span><br><span class="line"><span class="keyword">for</span> <span class="number">_</span> <span class="keyword">in</span> <span class="number">1</span>...<span class="number">1000</span> &#123;</span><br><span class="line">  <span class="type">Task</span> &#123; object.toggle() &#125;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">try</span> await <span class="type">Task</span>.sleep(<span class="keyword">for</span>: .seconds(<span class="number">1</span>))</span><br><span class="line"><span class="built_in">print</span>(object.someBool)</span><br></pre></td></tr></table></figure>
<p>这是一个相当大的问题，它正在发生，因为 <code>@ThreadSafe</code> 允许直接写入底层值。 所以像：</p>
<figure class="highlight swift"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">object.someBool = !object.someBool</span><br></pre></td></tr></table></figure>
<p>…隐藏竞争条件。</p>
<p>实际上，您可能应该直接在类中保留 Lock 值，而不是使用 <code>@ThreadSafe</code> 属性包装器，然后仅通过它的 withValue 进行变异。 当然，如果可变数据的安全是最重要的问题，那么您真的应该使用 actor。</p>
<p>3) 讨论<a href="https://forums.swift.org/t/using-snippets-in-documentation-comments-not-possible/65046" title="无法在文档注释中使用片段？" target="_blank" rel="noopener">无法在文档注释中使用片段？</a></p>
<p>我阅读 SE-0356 的方式应该可以在 Swift 包的 Snippets 文件夹中创建一个片段文件，然后通过@Snippet 在我的文档评论中引用它。</p>
<p>但这似乎并不像我预期的那样工作（使用 Xcode 14.3 / Swift 5.8）：</p>
<p><code>@Snippet</code> 给我警告：“符号源文档不支持指令”<br>显示我记录的类型的快速帮助不包括片段。</p>
<p>使用菜单“产品”&gt;“构建文档”生成没有代码片段的文档。</p>
<p><strong>回答</strong></p>
<p>片段在 Swift 5.7 中实现，并可通过 <code>swift-docc-plugin</code> 与 SwiftPM 一起使用，但正如其他人指出的那样，没有与基于 Xcode 的文档工作流集成，因为它使用不同的构建系统。 我会更新提案。</p>
<p>4) 讨论<a href="https://forums.swift.org/t/xcode-ignoring-package-resolved-file/65031" title="Xcode 忽略 Package.resolved 文件" target="_blank" rel="noopener"> Xcode 忽略 Package.resolved 文件</a></p>
<p>我不确定这是 SPM 问题还是 Xcode 问题，但将 SPM 与 Xcode 一起使用时最令人沮丧的经历之一是它经常忽略我的 repo 中的 <code>Package.resolved</code> 文件，通常是在切换分支或不同机器之间时。</p>
<p><code>Package.resolved</code> 文件应该是我的依赖项的真实来源，它永远不应该被忽略——如果有问题，包解析失败，但永远不要改变我的依赖项。</p>
<p>似乎发生的情况是，Xcode 更愿意使用其源缓存中恰好满足包版本要求的库版本，而不是解析文件中的库版本。 例如，我有一个版本要求为“2.2.0 up to next minor”的库。 </p>
<p>Package.resolved 文件中有 2.2.3，所以这是我希望始终使用的版本，除非我进行一些会引入冲突的更改。 当我在另一台机器上打开同一个项目时，出于某种原因它坚持要更改为 2.2.2，大概这是它缓存中的版本。 为什么？ 如果可以忽略已解析文件的意义何在？</p>
<p><strong>回答</strong></p>
<p>我可能遗漏了一些细节，但在更新到 Xcode 14.3 并在我们的 CI 中面对这个问题时，我们意识到我们从未使用 <code>-onlyUsePackageVersionsFromResolvedFile</code> 标志调用 xcodebuild。 现在我们这样做了，而且 CI 似乎尊重我们的 Package.resolved 文件。</p>
<p>对于我们来说，这个问题只存在于 Xcode 的 GUI 中。 （与此同时，我同样感到困惑，为什么需要 <code>-onlyUsePackageVersionsFromResolvedFile</code> 而不是 CLI 和 GUI 的默认模式！）</p>
<p>5) 讨论<a href="https://forums.swift.org/t/without-objective-c-or-swift-how-can-a-display-name-be-retrieved-from-cgdirectdisplayid-in-c-or-c/65034" title="如果没有 Objective-C 或 Swift，如何在 C 或 C++ 中从 CGDirectDisplayID 检索显示名称？" target="_blank" rel="noopener">如果没有 Objective-C 或 Swift，如何在 C 或 C++ 中从 CGDirectDisplayID 检索显示名称？</a></p>
<p>我试图在纯 C++（或 C）中从 <code>CGDirectDisplayID</code> 获取显示名称</p>
<p>我可以在 Objective-C++ 中做到这一点，类似于：</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#import <span class="meta-string">&lt;Foundation/Foundation.h&gt;</span></span></span><br><span class="line"><span class="meta">#import <span class="meta-string">&lt;CoreGraphics/CoreGraphics.h&gt;</span></span></span><br><span class="line"><span class="meta">#import <span class="meta-string">&lt;IOKit/graphics/IOGraphicsLib.h&gt;</span></span></span><br><span class="line"><span class="meta">#import <span class="meta-string">&lt;Cocoa/Cocoa.h&gt;</span></span></span><br><span class="line"></span><br><span class="line"><span class="meta">#include <span class="meta-string">&lt;string&gt;</span></span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">bool</span> getDisplayNameForDispID(<span class="built_in">CGDirectDisplayID</span> dispID,</span><br><span class="line">                             std::string&amp; strOutName)</span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">bool</span> bRes = <span class="literal">false</span>;</span><br><span class="line">    </span><br><span class="line">    strOutName.clear();</span><br><span class="line">    </span><br><span class="line">    <span class="built_in">NSArray</span> *screens = [<span class="built_in">NSScreen</span> screens];</span><br><span class="line"></span><br><span class="line">    <span class="keyword">for</span> (<span class="built_in">NSScreen</span> *screen <span class="keyword">in</span> screens)</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="built_in">NSDictionary</span>* screenDictionary = [screen deviceDescription];</span><br><span class="line">        <span class="keyword">if</span>(screenDictionary)</span><br><span class="line">        &#123;</span><br><span class="line">            <span class="built_in">NSNumber</span>* screenID = [screenDictionary objectForKey:<span class="string">@"NSScreenNumber"</span>];</span><br><span class="line">            <span class="keyword">if</span>(screenID)</span><br><span class="line">            &#123;</span><br><span class="line">                <span class="built_in">CGDirectDisplayID</span> aID = [screenID unsignedIntValue];</span><br><span class="line">                </span><br><span class="line">                <span class="keyword">if</span>(aID == dispID)</span><br><span class="line">                &#123;</span><br><span class="line">                    <span class="comment">//Got it</span></span><br><span class="line">                    <span class="built_in">NSString</span>* pName = [screen localizedName];</span><br><span class="line">                    </span><br><span class="line">                    strOutName.assign([pName UTF8String], [pName lengthOfBytesUsingEncoding:<span class="built_in">NSUTF8StringEncoding</span>]);</span><br><span class="line"></span><br><span class="line">                    bRes = <span class="literal">true</span>;</span><br><span class="line">                    </span><br><span class="line">                    <span class="keyword">break</span>;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;    </span><br><span class="line"></span><br><span class="line">    <span class="keyword">return</span> bRes;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>但是，我不想仅仅为了完成这一项任务而将这个缓慢的 Objective-C 代码添加到我的项目中。 在低级 C 中，必须有一种方法可以做到这一点。</p>
<p>我知道有一个完整的主题专门讨论它。 由于 <code>CGDisplayIOServicePort</code> 已弃用并且仅返回 0 并且任何后续调用都会执行操作，因此请注意，没有任何解决方法为 macOS Ventura 提供工作。</p>
<p><strong>回答</strong></p>
<p>如果您坚持不直接使用任何 Objective C 代码，您仍然可以使用 Objective C 运行时 API 从 C 调用 Objective C API，例如：</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">Class nsScreen = objc_lookUpClass(<span class="string">"NSScreen"</span>);</span><br><span class="line">objc_object *screens = objc_msgSend(nsScreen, sel_getUid(<span class="string">"screens"</span>));</span><br><span class="line"></span><br><span class="line"><span class="comment">// Desugaring "fast enumeration" is particularly knarly.</span></span><br><span class="line"><span class="comment">// for (NSScreen *screen in screens)</span></span><br><span class="line">objc_object *enumerator = objc_msgSend(screens, sel_getUid(<span class="string">"objectEnumerator"</span>));</span><br><span class="line">objc_object *screen;</span><br><span class="line"><span class="keyword">while</span> ((screen = objc_msgSend(enumerator, sel_getUid(<span class="string">"nextObject"</span>)) != <span class="literal">nil</span>) &#123;</span><br><span class="line">    <span class="comment">// ...</span></span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">// ...</span></span><br></pre></td></tr></table></figure>
<p>你会发现它比 Objective C 代码（实际上只是这类函数调用的语法糖）要“迟钝”得多，因为你需要一直转换所有内容。</p>
<p>我也完全忘记了手动添加内存管理。 你需要保留/释放一大堆东西。 真是一团糟。 如果你可以管理它，我强烈建议将其编译为 Objective C。</p>
<p>6) 讨论<a href="https://forums.swift.org/t/does-task-cancellation-propagate-to-urlsessiontasks/65041" title="任务取消是否传播到 URLSession 任务？" target="_blank" rel="noopener">任务取消是否传播到 URLSession 任务？</a></p>
<figure class="highlight swift"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">let</span> task = <span class="type">Task</span> &#123;</span><br><span class="line">  <span class="keyword">let</span> (data, response) = <span class="keyword">try</span> await <span class="type">URLSession</span>.shared.data(from: <span class="type">URL</span>(string: <span class="string">"https://some-image-url.com"</span>)!)</span><br><span class="line">  <span class="comment">// ...</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>然后我执行 <code>task.cancel()</code>，URLSession 是否也会自动取消 <code>URLSessionTask？</code> 假设 URLSessionTask 也被取消似乎很粗心，但我找不到关于此事的任何文档。 但是，如果 URLSessionTask 没有自动取消，那么我不得不使用基于闭包的 <code>URLSession.dataTask(with:,completionHandler:)</code> 来获取对 URLSessionTask 的引用，然后还调用 <code>dataTask.cancel()</code> 在 <code>task.cancel()</code> 之上，这有点奇怪。</p>
<p><strong>回答</strong></p>
<figure class="highlight swift"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> Foundation</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">func</span> <span class="title">main</span><span class="params">()</span></span> async &#123;</span><br><span class="line">    <span class="keyword">let</span> t = <span class="type">Task</span> &#123;</span><br><span class="line">        <span class="keyword">do</span> &#123;</span><br><span class="line">            <span class="built_in">print</span>(<span class="string">"<span class="subst">\(Date.now)</span>: task will start"</span>)</span><br><span class="line">            <span class="keyword">let</span> url = <span class="type">URL</span>(string: <span class="string">"https://postman-echo.com/delay/10"</span>)!</span><br><span class="line">            <span class="keyword">let</span> request = <span class="type">URLRequest</span>(url: url, cachePolicy: .reloadIgnoringLocalCacheData, timeoutInterval: <span class="number">60.0</span>)</span><br><span class="line">            <span class="keyword">let</span> (data, response) = <span class="keyword">try</span> await <span class="type">URLSession</span>.shared.data(<span class="keyword">for</span>: request)</span><br><span class="line">            <span class="built_in">print</span>(<span class="string">"<span class="subst">\(Date.now)</span>: task did complete, response: <span class="subst">\(response)</span>, data: <span class="subst">\(data)</span>"</span>)</span><br><span class="line">        &#125; <span class="keyword">catch</span> &#123;</span><br><span class="line">            <span class="built_in">print</span>(<span class="string">"<span class="subst">\(Date.now)</span>: task did error"</span>)</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">if</span> <span class="literal">true</span> &#123;</span><br><span class="line">        <span class="keyword">try</span>? await <span class="type">Task</span>.sleep(<span class="keyword">for</span>: .seconds(<span class="number">1</span>))</span><br><span class="line">        <span class="built_in">print</span>(<span class="string">"<span class="subst">\(Date.now)</span>: will cancel task"</span>)</span><br><span class="line">        t.cancel()</span><br><span class="line">        <span class="built_in">print</span>(<span class="string">"<span class="subst">\(Date.now)</span>: did cancel task"</span>)</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="built_in">print</span>(<span class="string">"<span class="subst">\(Date.now)</span>: waiting"</span>)</span><br><span class="line">    <span class="keyword">try</span>? await <span class="type">Task</span>.sleep(<span class="keyword">for</span>: .seconds(<span class="number">60</span>))</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">await main()</span><br></pre></td></tr></table></figure>
<p>打印结果：</p>
<figure class="highlight swift"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">2023</span>-<span class="number">05</span>-<span class="number">18</span> <span class="number">08</span>:<span class="number">18</span>:<span class="number">52</span> +<span class="number">0000</span>: task will start</span><br><span class="line"><span class="number">2023</span>-<span class="number">05</span>-<span class="number">18</span> <span class="number">08</span>:<span class="number">18</span>:<span class="number">53</span> +<span class="number">0000</span>: will cancel task</span><br><span class="line"><span class="number">2023</span>-<span class="number">05</span>-<span class="number">18</span> <span class="number">08</span>:<span class="number">18</span>:<span class="number">53</span> +<span class="number">0000</span>: did cancel task</span><br><span class="line"><span class="number">2023</span>-<span class="number">05</span>-<span class="number">18</span> <span class="number">08</span>:<span class="number">18</span>:<span class="number">53</span> +<span class="number">0000</span>: waiting</span><br><span class="line"><span class="number">2023</span>-<span class="number">05</span>-<span class="number">18</span> <span class="number">08</span>:<span class="number">18</span>:<span class="number">53</span> +<span class="number">0000</span>: task did error</span><br></pre></td></tr></table></figure>
<p>7) 讨论<a href="https://forums.swift.org/t/evolving-the-swift-workgroups/65052" title="发展 Swift 工作组" target="_blank" rel="noopener">发展 Swift 工作组</a></p>
<p>今天，Swift 核心团队宣布对 Swift 的结构、工作和周围的人进行前瞻性的改变。 这些更改包括新的组、名称、组织以及作为每个组的一流概念的包含。</p>
<p>链接：<a href="https://www.swift.org/blog/evolving-swift-project-workgroups/" target="_blank" rel="noopener">https://www.swift.org/blog/evolving-swift-project-workgroups/</a></p>
<h2 id="推荐博文"><a href="#推荐博文" class="headerlink" title="推荐博文"></a>推荐博文</h2><p><a href="https://juejin.cn/post/7231359714055077946/" title="万字长文详解如何使用 Swift 提高代码质量 | 京东云技术团队" target="_blank" rel="noopener">万字长文详解如何使用 Swift 提高代码质量 | 京东云技术团队</a></p>
<p><strong>摘要：</strong> 文章介绍了如何使用 Swift 提高代码质量。 Swift 的三个重要特性：富有表现力、安全性和快速。通过使用这些特性，可以提高代码质量并减少 Crash 的发生率。同时，本文还分享了一些实践技巧来提高使用 Swift 编写代码的效率和可读性，如利用编译检查、减少使用 Any/AnyObject 、不推荐大量使用 Dictionary 数据结构等。最后，从性能优化的角度，谈到了使用源代码打包，减少方法动态派发，使用 Slice 共享内存优化性能等来提高代码质量。</p>
<p><a href="https://swiftwithmajid.com/2023/05/03/the-power-of-overlays-in-swiftui/" title="swiftUI 中视图叠加的强大能力" target="_blank" rel="noopener">swiftUI 中视图叠加的强大能力</a></p>
<p><strong>摘要：</strong> 本博客文章讨论了 SwiftUI 中两个有趣的叠加使用案例。第一个案例涉及使用叠加来保持视图的结构标识，这对于防止性能问题和状态丢失至关重要。第二个用例是通过叠加视图修饰符构建自定义导航转换，使开发人员能够创建流畅的动画而不依赖 NavigationView 或 NavigationStack。提供示例以说明这些概念，并提供其他资源供进一步学习。总体而言，本文展示了 SwiftUI 中叠加功能的强大之处以及它们如何增强应用程序开发中用户体验。</p>
<p><a href="https://swiftwithmajid.com/2023/05/10/file-importing-and-exporting-in-swiftui/" title="SwiftUI 中的文件导入和导出" target="_blank" rel="noopener">SwiftUI 中的文件导入和导出</a></p>
<p><strong>摘要：</strong> 本篇博客讨论了如何使用 fileImporter 和 fileExporter 视图修饰符在 SwiftU I视图中导入和导出文件。文章包括两种操作的代码示例，以及一个额外部分介绍如何使用 fileMover 视图修改器进行文件移动。此外，还介绍了 TextDocument 类型，它符合 FileDocument 协议并允许从文件读取纯文本字符串，并将字符串数据导出到文件。总体而言，这篇文章强调了使用这些简单的视图修饰符可以轻松实现 SwiftUI 应用程序中的文件管理体验。</p>
<h2 id="话题讨论"><a href="#话题讨论" class="headerlink" title="话题讨论"></a>话题讨论</h2><p><strong>一群男的在找女朋友，一群女的在找男朋友，两群人互不干涉，什么原因引起的？</strong></p>
<p>1、社交隔阂：社交圈子的分隔和交流机会的减少<br>2、忙碌生活：现代社会的快节奏和高压力导致个人时间和精力有限<br>3、数字化社交：社交媒体和在线交友平台的兴起导致<br>4、个人选择标准的提高：个人对伴侣的要求变得更加苛刻，导致匹配的难度增加<br>5、社会观念的变化：个人对恋爱和婚姻的态度发生了变化，导致对寻找恋爱对象的需求减少</p>
<p>欢迎在文末留言参与讨论。</p>
<h2 id="关于我们"><a href="#关于我们" class="headerlink" title="关于我们"></a>关于我们</h2><p><strong>Swift社区</strong>是由 Swift 爱好者共同维护的公益组织，我们在国内以微信公众号的运营为主，我们会分享以 <strong>Swift实战</strong>、<strong>SwiftUl</strong>、<strong>Swift基础</strong>为核心的技术内容，也整理收集优秀的学习资料。</p>
<p>欢迎关注公众号:Swift社区，后台点击进群，可以进入我们社区的交流讨论群。希望我们Swift社区是大家在网络空间中的另一份共同的归属。</p>
<p><img width="500" alt="Swift社区" src="https://user-images.githubusercontent.com/24238160/132703149-34121c6c-fd18-491c-a697-58a0fabf3060.png"></p>
<p>特别感谢 Swift社区 编辑部的每一位编辑，感谢大家的辛苦付出，为 Swift社区 提供优质内容，为 Swift 语言的发展贡献自己的力量。</p>

      
    </div>
    
    
    
    

    
      <div>
        <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">-------------本文结束<i class="fa fa-paw"></i>感谢您的阅读-------------</div>
    
</div>

      </div>
    


    
      <div>
        
<div class="my_post_copyright">
  <script src="//cdn.bootcss.com/clipboard.js/1.5.10/clipboard.min.js"></script>

  <!-- JS库 sweetalert 可修改路径 -->
  <script src="https://cdn.bootcss.com/jquery/2.0.0/jquery.min.js"></script>
  <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
  <p><span>本文标题:</span><a href="/Swift-周报-第二十九期/">Swift 周报 第二十九期</a></p>
  <p><span>文章作者:</span><a href="/" title="访问 Swift社区 的个人博客">Swift社区</a></p>
  <p><span>发布时间:</span>2023年07月04日 - 15:07</p>
  <p><span>最后更新:</span>2023年07月04日 - 15:07</p>
  <p><span>原始链接:</span><a href="/Swift-周报-第二十九期/" title="Swift 周报 第二十九期">https://fanbaoying.github.io/Swift-周报-第二十九期/</a>
    <span class="copy-path"  title="点击复制文章链接"><i class="fa fa-clipboard" data-clipboard-text="https://fanbaoying.github.io/Swift-周报-第二十九期/"  aria-label="复制成功！"></i></span>
  </p>
  <p><span>许可协议:</span><i class="fa fa-creative-commons"></i> <a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
</div>
<script> 
    var clipboard = new Clipboard('.fa-clipboard');
      $(".fa-clipboard").click(function(){
      clipboard.on('success', function(){
        swal({   
          title: "",   
          text: '复制成功',
          icon: "success", 
          showConfirmButton: true
          });
        });
    });  
</script>

      </div>
    


    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>坚持原创技术分享，您的支持将鼓励我继续创作！</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/images/wechat.png" alt="Swift社区 微信支付"/>
        <p>微信支付</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/images/alipay.png" alt="Swift社区 支付宝"/>
        <p>支付宝</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Swift/" rel="tag"><i class="fa fa-tag"></i> Swift</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/Swift-周报-第二十八期/" rel="next" title="Swift 周报 第二十八期">
                <i class="fa fa-chevron-left"></i> Swift 周报 第二十八期
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/Swift-周报-第三十期/" rel="prev" title="Swift 周报 第三十期">
                Swift 周报 第三十期 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
        <!-- JiaThis Button BEGIN -->
<div class="jiathis_style">
<span class="jiathis_txt">分享到：</span>
<a class="jiathis_button_fav">收藏夹</a>
<a class="jiathis_button_copy">复制网址</a>
<a class="jiathis_button_email">邮件</a>
<a class="jiathis_button_weixin">微信</a>
<a class="jiathis_button_qzone">QQ空间</a>
<a class="jiathis_button_tqq">腾讯微博</a>
<a class="jiathis_button_douban">豆瓣</a>
<a class="jiathis_button_share">一键分享</a>

<a href="http://www.jiathis.com/share?uid=2140465" class="jiathis jiathis_txt jiathis_separator jtico jtico_jiathis" target="_blank">更多</a>
<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" >
var jiathis_config={
  data_track_clickback:true,
  summary:"",
  shortUrl:false,
  hideMore:false
}
</script>
<script type="text/javascript" src="http://v3.jiathis.com/code/jia.js?uid=" charset="utf-8"></script>
<!-- JiaThis Button END -->
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="https://avatars.githubusercontent.com/u/84354365?v=4"
                alt="Swift社区" />
            
              <p class="site-author-name" itemprop="name">Swift社区</p>
              <p class="site-description motion-element" itemprop="description">我们的使命是做一个最专业最权威的 Swift 中文社区，我们的愿景是希望更多的人学习和使用Swift。我们会分享以 Swift 实战、SwiftUI、Swift 基础为核心的技术干货，不忘初心，牢记使命。</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">187</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">19</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">11</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://blog.csdn.net/qq_36478920" target="_blank" title="CSDN">
                      
                        <i class="fa fa-fw fa-heartbeat"></i>CSDN</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://juejin.im/user/5a30d987f265da430d580126" target="_blank" title="掘金">
                      
                        <i class="fa fa-fw fa-spinner"></i>掘金</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/fanbaoying" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://www.zhihu.com/people/swift-community" target="_blank" title="知乎">
                      
                        <i class="fa fa-fw fa-heartbeat"></i>知乎</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://weibo.com/u/7711465033" target="_blank" title="微博">
                      
                        <i class="fa fa-fw fa-weibo"></i>微博</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://mp.weixin.qq.com/mp/appmsgalbum?__biz=MzAxNzgzNTgwMw==&action=getalbum&album_id=2024314764775981057" target="_blank" title="公众号">
                      
                        <i class="fa fa-fw fa-heartbeat"></i>公众号</a>
                  </span>
                
            </div>
          

          
          

          
          
            <div class="links-of-blogroll motion-element links-of-blogroll-block">
              <div class="links-of-blogroll-title">
                <i class="fa  fa-fw fa-link"></i>
                友情链接
              </div>
              <ul class="links-of-blogroll-list">
                
                  <li class="links-of-blogroll-item">
                    <a href="https://github.com/SwiftCommunityRes/SwiftWeekly" title="SwiftWeekly" target="_blank">SwiftWeekly</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://github.com/SwiftCommunityRes/article-ios" title="Article-ios" target="_blank">Article-ios</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://github.com/SwiftCommunityRes/SwiftUI-Book" title="SwiftUI-Book" target="_blank">SwiftUI-Book</a>
                  </li>
                
              </ul>
            </div>
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#前言"><span class="nav-number">1.</span> <span class="nav-text">前言</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#新闻和社区"><span class="nav-number">2.</span> <span class="nav-text">新闻和社区</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#担心泄密！外媒：苹果公司限制员工使用ChatGPT"><span class="nav-number">2.1.</span> <span class="nav-text">担心泄密！外媒：苹果公司限制员工使用ChatGPT</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#苹果公司大幅削减其MR头显销售预期，不足百万台"><span class="nav-number">2.2.</span> <span class="nav-text">苹果公司大幅削减其MR头显销售预期，不足百万台</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#提案"><span class="nav-number">3.</span> <span class="nav-text">提案</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#通过的提案"><span class="nav-number">3.1.</span> <span class="nav-text">通过的提案</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#正在审查的提案"><span class="nav-number">3.2.</span> <span class="nav-text">正在审查的提案</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Swift-论坛"><span class="nav-number">4.</span> <span class="nav-text">Swift 论坛</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#推荐博文"><span class="nav-number">5.</span> <span class="nav-text">推荐博文</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#话题讨论"><span class="nav-number">6.</span> <span class="nav-text">话题讨论</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#关于我们"><span class="nav-number">7.</span> <span class="nav-text">关于我们</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<div class="copyright">&copy; <span itemprop="copyrightYear">2024</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Swift社区</span>

  
</div>

<!-- 
<div class="powered-by">
  <i class="fa fa-user-md">
  </i>
  <span id="busuanzi_container_site_uv">
    已有<span id="busuanzi_value_site_uv"></span>人来访
  </span>

</div>


  <span class="post-meta-divider">|</span>


<div class="powered-by">
  <i class="fa fa-eye"></i>
  <span id="busuanzi_container_site_pv">
      访问量<span id="busuanzi_value_site_pv"></span>次
  </span>
</div>



  <span class="post-meta-divider">|</span>


-->

<div class="theme-info">
  <i class="fa fa-pencil"></i>
  <span class="post-count">博客全站共361.6k字</span>
</div>


<!-- 
  <span class="post-meta-divider">|</span>



  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Pisces</a> v5.1.4</div>



-->

        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
